/**
 *	@author Juntalis
 */

/**
 * Core bot class.
 */
var Bot = {
	Name : "",
	Password : "",
	Server : {
		Name : "",
		Host : "",
		Port : 0,
		Auth : 0,
		_blRequestClose : false,
	},
	SckClient : new socket(),
	Connect : function(host,port) {
		if(this.isConnected()) this.Disconnect();
			this.SckClient.connect(host,port);
	},
	Disconnect : function() {
		if (this.isConnected()) {
			this.Server._blRequestClose = true;
			this.SckClient.close();
		}
	},
	Send : function(msg) {
		if(this.isConnected())
			if(msg!=null)
				if(msg.length > 0)
					this.SckClient.send(msg);
	},
	Say : function(msg) {
		if(this.isConnected())
			if(msg!=null)
				if(msg.length > 0)
					this.SckClient.send("SAY " + msg);
	},
	Whisper : function(usr,msg) {
		if(this.isConnected())
			if((usr!=null)&&(msg!=null))
				if((usr.length > 0)&&(msg.length > 0))
					this.SckClient.send("whisper " + usr + " " + msg);
	},
	CenterPrint : function(msg) {
		if(this.isConnected())
			if(msg!=null)
				if(msg.length > 0)
					this.SckClient.send("centerprint " + msg);
	},
	Kick : function(usr) {
		if(this.isConnected())
			if(usr!=null)
				if(usr.length > 0)
					this.SckClient.send("kick " + usr);
	},
	Ban : function(usr) {
		if(this.isConnected())
			if(usr!=null)
				if(usr.length > 0)
					this.SckClient.send("ban " + usr);
	},
	isConnected : function() {
		return this.SckClient.connected();
	},
	Scripted : {
		Settings : {
			override : false
		},
		Connect : null,
		Disconnect : null,
		ServerMessage: null,
		UserSay : null,
		UserWhisper : null,
		UserJoin : null,
		UserLeave : null,
		Input : null
	}
};
